package com.bzkj.web.controller.wms;

import com.bzkj.basicinfo.domain.wms.dto.FreezeDto;
import com.bzkj.basicinfo.service.wms.WmsStoStockLimitationTypeService;
import com.bzkj.common.annotation.LogC;
import com.bzkj.common.core.domain.AjaxResult;
import com.bzkj.common.core.domain.R;
import com.bzkj.common.enums.BusinessType;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Date 2025/01/02 13:30:30
 * @description
 */
@RestController
@RequestMapping("wms/stoStockLimitation")
public class WmsStoStockLimitationTypeController
{
    @Autowired
    private WmsStoStockLimitationTypeService wmsStoStockLimitationTypeService;


    /**
     * 获取所有的类型
     *
     * @return
     */
    @ApiOperation("查询限制类型下拉接口")
    @RequestMapping("findTypeList")
    public R findTypeList()
    {
        return wmsStoStockLimitationTypeService.findTypeList();
    }

    /**
     * 获取冻结明细信息
     *
     * @param pkMaterial
     * @param pkBatchCode
     * @return
     */
    @ApiOperation("查看冻结明细接口")
    @GetMapping("findLimitationInfo")
    public R findLimitationInfo(@RequestParam String pkMaterial, @RequestParam(required = false) String pkBatchCode)
    {
        return wmsStoStockLimitationTypeService.findLimitationInfo(pkMaterial, pkBatchCode);
    }

    /**
     * 单据类型状态修改
     *
     * @param id
     * @return
     */
    @ApiOperation("解冻接口")
    @PutMapping("putBillsTypeEnableStatus")
    @LogC(title = "冻结数据", businessType = BusinessType.UNFREEZE,content = "'商品名称: '+#dto.name+',批号: '+#dto.vbatchcode")
    public AjaxResult putBillsTypeEnableStatus(@RequestBody FreezeDto dto)
    {
        return wmsStoStockLimitationTypeService.putBillsTypeEnableStatus(dto.getId());
    }

    /**
     * 追溯码状态修改
     *
     * @param id
     * @param batchId
     * @param pkMaterial
     * @param pkBatchcode
     * @return
     */
    @PutMapping("putBatchEnableStatus")
    public R putBatchEnableStatus(@RequestParam String id, @RequestBody List<String> batchId, @RequestParam String pkMaterial, @RequestParam String pkBatchcode)
    {
        return wmsStoStockLimitationTypeService.putBatchEnableStatus(id, batchId, pkMaterial, pkBatchcode);
    }

}
